home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_03_05 / 3n05018a < prev    next >
Text File  |  1992-03-02  |  1KB  |  46 lines

  1. Listing 1
  2.  
  3. Sample program
  4.  
  5. . Simple List Program.
  6. .
  7. FILENAME  DIM      30
  8. DATAFILE  FILE
  9. SEQ       FORM     "-1"
  10. RECORD    DIM      133
  11. COUNTER   FORM     5
  12. STATE     DIM      2
  13. STATE1    INIT     "AL"
  14. STATE2    INIT     "AK"
  15. STATE3    INIT     "AR"
  16. STATE4    INIT     "AZ"
  17. INDEX     FORM     2
  18. .
  19. .         Start of the program.
  20. .
  21.           DISPLAY  *ES,"SIMPLE LIST ":
  22.                    "PROGRAM"
  23. REENTER   KEYIN    "ENTER FILE NAME: ":
  24.                    *ESCON,FILENAME
  25.           STOP     IF ESCAPE
  26.           TRAP     ERROR IF IO
  27.           OPEN     DATAFILE,FILENAME
  28.           MOVE     "0",COUNTER
  29.           LOOP
  30.           FILEPI   1;DATAFILE
  31.           READ     DATAFILE,SEQ;INDEX,RECORD
  32.           LOAD     STATE FROM INDEX OF STATE1,STATE2,STATE3,STATE4
  33.           WHILE    NOT OVER
  34.           PRINT    STATE,RECORD
  35.           ADD      "1",COUNTER
  36.           DISPLAY  *P1:4,"RECORDS: ",COUNTER
  37.           REPEAT
  38.           KEYIN    "Listing finished.  ":
  39.                    "Tap enter. ",ANS
  40.           STOP
  41. ERROR     NORETURN
  42.           KEYIN    *B,*HD,"FILE NOT FOUND. ":
  43.                    " TAP ENTER. ",*HD,*EL
  44.           GOTO     REENTER
  45.  
  46.